package thread.threaddemo;

/**
 * @Author: wenjingyuan
 * @Date: 2022/11/01/11:13
 * @Description:继承Thread来创建线程
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        Thread mainThread=Thread.currentThread();
        System.out.println("线程名称"+mainThread.getName());
        Thread thread=new MyThread();
        //开启线程
        //thread.start();
        thread.run();
    }
}

class MyThread extends Thread{
    @Override
    public void run() {
//        //具体的业务代码
        System.out.println("你好，线程!");
//        try {
//            Thread.sleep(1000*60*60);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        //System.out.println("线程的名称"+Thread.currentThread().getName());
    }
}
